<template>
  <div class="hotserch-box">
    <div class="hot-tilte">
      <p>{{title}}</p>
      <p>
        <slot name="deleteHistory"></slot>
      </p>
    </div>
    <div class="hot-box">
      <p v-if="citys.length == 0" id="empty-box">空空如也~</p>
      <div v-for="(item,index) of citys" :key="index" v-else>
        <div @click="toHotCity(item)">{{item}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "hotserch",
  props: {
    citys: {
      type: Array,
      default: [],
    },
    title: {
      type: String,
      default: "",
    },
  },
  methods: {
    toHotCity(item) {
      this.$emit("toHotCity", item);
    },
  },
};
</script>

<style scoped>
.hotserch-box {
  background-color: #fff;
  margin: 20px 15px;
  padding-top: 15px;
  padding-bottom: 15px;
  border-radius: 15px;
}
.hot-tilte {
  display: flex;
  justify-content: space-between;
  padding-left: 20px;
  margin-right: 20px;
  font-weight: 700;
}
.hot-box {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  margin-top: 5px;
  padding-left: 20px;
}
.hot-box > div {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 33.33%;
  height: 50px;
  font-size: 14px;
}
.hot-box > div div {
  padding: 6px 0;
  width: 80px;
  text-align: center;
  background-color: #efefef;
  border-radius: 5px;
}
#empty-box{
  font-size: 13px;
  height: 30px;
  line-height: 30px;
}
</style>